<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Phụ cấp chức vụ';
$this->template->display('dsp_header.php');
$v_MA_CHUC_VU_filter = $arr_filter['cbx_MA_CHUC_VU_filter'];

?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');

    echo $this->hidden('hdn_dsp_single_method','dsp_single_phucapchucvu');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_phucapchucvu');
    echo $this->hidden('hdn_update_method','update_phucapchucvu');
    echo $this->hidden('hdn_delete_method','delete_phucapchucvu');
    $v_row = 0;
    ?>
     <div id="div_filter">
        <label>Chức vụ </label>
        <select id="cbx_MA_CHUC_VU_filter"
                name="cbx_MA_CHUC_VU_filter"
                onchange="this.form.submit();"
                >
                  <?php while ($arr = $arr_all_chucvu_filter->FetchRow()): ?>
                  <?php
                   $MA_CHUC_VU_CBX=$arr['MA_CHUC_VU'];
                   $TEN_CHUC_VU_CBX=$arr['TEN_CHUC_VU'];
                  ?>
                   <?php if($v_MA_CHUC_VU_filter == $MA_CHUC_VU_CBX):?>
                     <option value="<?php echo $MA_CHUC_VU_CBX; ?>" selected="selected"><?php echo $TEN_CHUC_VU_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_CHUC_VU_CBX; ?>" ><?php echo $TEN_CHUC_VU_CBX; ?></option>
                  <?php endif ?>
                <?php endwhile; ?>
        </select>
        <input class = 'button' type="button" name="btn_add_phucapchucvu" value="Thêm phụ cấp" onclick="row_phucapchucvu_onclick_pop_win('0')"/>
     	</div>
    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="30%" />
            <col width="30%" />
            <col width="18%" />
            <col width="6%" />
            <col width="8%" />
            <col width="8%" />
        </colgroup>
        <tr class="header-table">
            <th>Chức vụ</th>
            <th>Tên phụ cấp chức vụ</th>
            <th>Hệ số phụ cấp chức vụ</th>
            <th>Thứ tự</th>
            <th>Trạng thái</th>
            <th>Thao tác</th>
        </tr>
        <?php while ($arr = $arr_all_phucapchucvu->FetchRow()): ?>
            <?php
             $MA_PHU_CAP_CHUC_VU=$arr['MA_PHU_CAP_CHUC_VU'];
             $TEN_PHU_CAP_CHUC_VU=$arr['TEN_PHU_CAP_CHUC_VU'];
             $TEN_CHUC_VU=$arr['TEN_CHUC_VU'];
             $HE_SO_PHU_CAP_CHUC_VU=$arr['HE_SO_PHU_CAP_CHUC_VU'];
             $STT_PHU_CAP_CHUC_VU=$arr['STT_PHU_CAP_CHUC_VU'];
             $TEN_TRANG_THAI=$arr['TEN_TRANG_THAI'];
             $v_class = 'row' . ($v_row % 2);
             $v_row++;
            ?>
            <tr class="<?php echo $v_class;?>">
                <td><?php echo $TEN_CHUC_VU;?></td>
                <td><?php echo $TEN_PHU_CAP_CHUC_VU;?></td>
                <td><?php echo $HE_SO_PHU_CAP_CHUC_VU;?></td>
                <td style="text-align:center"><?php echo $STT_PHU_CAP_CHUC_VU;?></td>
                <td style="text-align:center"><?php echo $TEN_TRANG_THAI;?></td>
                <td style="text-align:center">
                    <a href="javascript:void(0)" onclick="row_phucapchucvu_onclick_pop_win('<?php echo $MA_PHU_CAP_CHUC_VU;?>')">Sửa</a> |
                    <a href="javascript:void(0)" onclick="quick_delete_phucapchucvu('<?php echo $MA_PHU_CAP_CHUC_VU;?>')">Xoá</a>
                </td>
            </tr>
        <?php endwhile; ?>
        <?php echo $this->add_empty_rows($v_row +1, _CONST_DEFAULT_ROWS_PER_PAGE, 6); ?>
    </table>

</form>
<script>
    function row_phucapchucvu_onclick_pop_win(maphucapchucvu){
        var url = '<?php echo $this->get_controller_url();?>dsp_single_phucapchucvu/'  + maphucapchucvu
            url += '/?&maphucapchucvu=' + maphucapchucvu + '&hdn_item_id=' + maphucapchucvu + '&pop_win=1';
       showPopWin(url ,600,270, null);
    }
    function quick_delete_phucapchucvu(maphucapchucvu)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  maphucapchucvu;
            m = $("#controller").val() + 'delete_phucapchucvu'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }
</script>
<?php $this->template->display('dsp_footer.php');